package com.example.librarymanagementproject2.model.document;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

/**
 * @ClassName BookCategoryDocument
 * @Description 图书文档信息类
 * @Author Kx
 * @Date 2025/10/27 15:10
 * @Version 1.0
 */
@Document(indexName = "book", createIndex = false)
@Data
@AllArgsConstructor
@NoArgsConstructor
public class BookDocument {
    @Id
    private Long id; // 编号
    @Field(type = FieldType.Text, analyzer = "ik_max_word")
    private String categoryName; // 分类名称
    @Field(type = FieldType.Text, analyzer = "ik_max_word")
    private String bookName; // 图书名称
    @Field(type = FieldType.Text, analyzer = "ik_max_word")
    private String author; // 作者
    @Field(type = FieldType.Text, analyzer = "ik_max_word")
    private String publisher; // 出版社
    @Field(type = FieldType.Keyword, index = false)
    private String description; // 图书简介
    @Field(type = FieldType.Keyword, index = false)
    private String coverUrl; // 图书封面
    @Field(type = FieldType.Integer, index = false)
    private Integer status; // 状态(0-下架，1-上架)
}
